<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateMedicalTakeDrugRecordTable
 * 病历药物服用库
 */
class CreateMedicalTakeDrugRecordTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('st_medical_take_drug_record', function (Blueprint $table) {
            $table->increments('id')->comment('服用药物记录表');
            $table->unsignedInteger('medical_id')->comment('病历表id');
            $table->unsignedTinyInteger('medical_type')->comment('0现病史页-西医，1既往史-西医，2处理页-西医,3现病史页-中医，4处理页-中医，5现病史页(现病史子表)-西医，6现病史页(现病史子表)-中医，7处理页(现病史子表)-西医，8处理页(现病史子表)-中医');
            $table->unsignedInteger('drug_id')->comment('药物id');
            $table->date('start_at')->comment('用药开始时间');
            $table->date('end_at')->comment('用药结束时间');
            $table->unsignedInteger('count')->comment('服药数量');
            $table->unsignedInteger('add_user')->comment('添加人');
            $table->timestamp('add_time')->comment('添加时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('st_medical_take_drug_record');
    }
}
